<!--头部-->
<style>
    #bottom {
        width: 120px;
        position: fixed;
        z-index: 99999;
        cursor: move;
        _position: absolute;
        height: 130px;
        box-shadow: -5px 5px 10px #000;
        right: 15px;
        top: 350px;
        border: 5px solid #eee;
        background-color: #fff;
        font-size: 0;
        line-height: 0;
        text-align: right;
    }
</style>
<div class="main-layout-header">
    <div class="menu-btn" id="hideBtn">
        <a href="javascript:void(0);">
            <span class="iconfont">&#xe60e;</span>
        </a>
    </div>
    <iframe style="margin: 0 0 0 20px;float: left;" name="weather_inc" src="http://i.tianqi.com/index.php?c=code&id=9"
            width="500" height="60" frameborder="0"
            marginwidth="0" marginheight="0" scrolling="no"></iframe>
    <ul class="layui-nav" lay-filter="rightNav">
        <li class="layui-nav-item">
            <div class="user-headface" style="width: 80px;">
                <a href="javascript:void(0);" data-url="{{route($fid['label'])}}" data-id='{{$fid['id']}}'
                   data-text="{{$fid['name']}}">
                    <img title="{{$fid['name']}}" alt="{{$user->name}}"
                         style="margin:-10px;width: 60px;height: 60px;border-radius: 50%;" id="filename"
                         src="@if(isset($user->info->file)){{assetImage($user->info->file->url) ? : asset('static/admin/icon/35508.png')}}@else {{asset('static/admin/icon/35508.png')}}@endif">
                </a>
            </div>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:void(0);">清除缓存</a>
            <dl class="layui-nav-child"> <!-- 二级菜单 -->
                <dd><a href="javascript:void(0);" onclick="cache('all')">全部缓存</a></dd>
                <dd><a href="javascript:void(0);" onclick="cache('config')">配置缓存</a></dd>
                <dd><a href="javascript:void(0);" onclick="cache('route')">路由缓存</a></dd>
                <dd><a href="javascript:void(0);" onclick="cache('view')">文件缓存</a></dd>
                <dd><a href="javascript:void(0);" onclick="cache('cache')">数据缓存</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:void(0);" title="{{$fid['name']}}" data-url="{{route($fid['label'])}}"
               data-id='{{$fid['id']}}'
               data-text="{{$fid['name']}}">{{$user->name}}</a>
        </li>
        <li class="layui-nav-item">
            <a class="dropdown-item" href="{{ route('logout') }}" title="退出"
               onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                {{ __('退出') }}
            </a>
            <form id="logout-form" action="{{ route('logout') }}" method="POST"
                  style="display: none;">
                @csrf
            </form>
        </li>
    </ul>
    <div id="retroclockbox1" style="float: left;margin: 5px 0 0 60px;"></div>
    <div>
        <div id="bottom">
            <div style="margin:20px 10px 5px 0">
                <a href="javascript:;" title="删除" onclick="$('#bottom').remove()"> <i class="layui-icon">&#x1006;</i>删除</a>
            </div>
            <div style="padding: 10px;">
                <div class="user-headface">
                    <a style="font-size: 16px;" class="layui-btn layui-btn-small layui-btn-primary"
                       id='email-refresh-btn'
                       href="/" data-title='刷新'>
                        <i class="layui-icon">&#x1002;</i>
                        &nbsp;&nbsp;刷&nbsp;新&nbsp;&nbsp;
                    </a>
                </div>
            </div>
            <div style="padding:10px;">
                <a target="_blank" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=KxoeHx0cGR0aEhJrWloFSERG"
                   style="text-decoration:none;">
                    <img src="http://rescdn.qqmail.com/zh_CN/htmledition/images/function/qm_open/ico_mailme_02.png"/>
                </a>
            </div>
        </div>
    </div>
</div>
<script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
<script type="application/javascript">
    function cache(status) {
        layui.use(['jquery', 'dialog'], function () {
            var $ = layui.jquery;
            var dialog = layui.dialog;
            dialog.confirm({
                message: '清除缓存？',
                success: function () {
                    $.ajax({
                        type: 'PATCH',
                        url: '{{route('cache')}}',
                        data: {status: status, filter: true},
                        dataType: "json",
                        beforeSend: function () {
                            layer.load(1, {
                                shade: [0.1, '#333333'] //0.1透明度的白色背景
                            });
                        },
                        complete: function (XHR) {
                            XHR = null;
                        },
                        error: function (xhr) {//获取ajax的错误信息
                            layer.alert(xhr.responseText, "Failed", function () {
                                layer.closeAll();
                            });
                        },
                        success: function (res) {
                            layer.closeAll();
                            if (res.code == 403) {
                                layer.msg(res.msg, {icon: 4, time: 3000})
                                return false;
                            }
                            if (res.code != 200) {
                                layer.msg(res.msg, {icon: 5, time: 3000})
                                return false;
                            }
                            layer.msg(res.msg, {icon: 1, time: 3000}, function () {
                                window.location.reload();
                            });
                        }
                    })
                },
                cancel: function () {
                    return false;
                }
            })
            return false;
        })
    }

    window.onload = function () {
        var oDiv = document.getElementById('bottom');
        var disX = 0, disY = 0;
        oDiv.onmousedown = function (ev) {
            var oEvent = ev || event;
            disX = oEvent.clientX - oDiv.offsetLeft;
            disY = oEvent.clientY - oDiv.offsetTop;
            document.onmousemove = function (ev) {
                var oEvent = ev || event;
                var l = oEvent.clientX - disX;
                var t = oEvent.clientY - disY;
                if (l <= 0) {
                    l = 0
                }
                if (t < 0) {
                    t = 0
                }
                if (l > document.documentElement.clientWidth - oDiv.offsetWidth) {
                    l = document.documentElement.clientWidth - oDiv.offsetWidth;
                }
                if (t > document.documentElement.clientHeight - oDiv.offsetHeight) {
                    t = document.documentElement.clientHeight - oDiv.offsetHeight;
                }
                oDiv.style.left = l + 'px';
                oDiv.style.top = t + 'px';

            }

            document.onmouseup = function (ev) {
                document.onmousemove = null;
                document.onmouseup = null;
            }

        }
    }
</script>

